package com.yanqu.road.server.cmd.kuang.battle;

import com.yanqu.road.entity.kuang.KuangConfig;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.kuang.Kuang;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.kuang.KuangModule;
import com.yanqu.road.server.manger.kuang.KuangMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_KUANG_GET_USER_ABILITY_RANK, desc = "获取区服玩家赚钱数据")
public class KuangBattleGetUserAbilityRankCmd extends AbstractCommand {

    private long targetServerId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        Kuang.KuangUserAbilityRankListReqMsg reqMsg = Kuang.KuangUserAbilityRankListReqMsg.parseFrom(packet.getBytes());
        targetServerId = reqMsg.getTargetServerId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        KuangConfig config = KuangMgr.getConfig();
        if (config == null) {
            ret = GameErrorCode.E_KUANG_CONFIG_NOT_FOUND;
            return;
        }
        player.getModule(KuangModule.class).getUserAbilityRank(targetServerId);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
